package com.eduadmin.service;

import com.eduadmin.entity.Exam;
import com.eduadmin.mapper.ExamMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ExamServiceImpl implements IExamService {
    private final ExamMapper examMapper;

    @Autowired
    public ExamServiceImpl(ExamMapper exam) {
        this.examMapper = exam;
    }

    @Override
    public List<Exam> getAllExam() {
        return examMapper.getAllExam();
    }

    @Override
    public int addExams(List<Exam> exams) {
        return examMapper.insertExams(exams);
    }

    @Override
    public List<Exam> getAllExams(Map<String, Object> paraMap) {
        return examMapper.selectAllExams(paraMap);
    }

    @Override
    public Long getAllTotal(Map<String, Object> paraMap) {
        return examMapper.selectAllTotal(paraMap);
    }

    @Override
    public int newAddExam(Exam exam) {
        return examMapper.insertExam(exam);
    }

    @Override
    public void updateExam(Exam exam) {
        examMapper.updateExam(exam);
    }

    @Override
    public int deleteExam(String examIdString) {
        return examMapper.deleteExam(examIdString);
    }

    @Override
    public Exam getExam(Exam exam) {
        return examMapper.selectExam(exam);
    }

    public List<Exam> getExamByExamName(String examName) {
        return examMapper.getExamByExamName(examName);
    }

    public Exam getExamByParams(Map<String, Object> paraMap) {
        return examMapper.getExamByParams(paraMap);
    }


}
